package cn.cerc.sample.ui;

import cn.cerc.mis.core.IForm;
import cn.cerc.ui.grid.UIDataStyle;
import cn.cerc.ui.grid.UIDataStyleImpl;
import cn.cerc.ui.grid.UIGridView;
import cn.cerc.ui.phone.UIPanelView;
import cn.cerc.ui.phone.UIPhoneView;
import cn.cerc.ui.vcl.UIButton;
import cn.cerc.ui.vcl.UIForm;

public class UISearchPage extends UICustomPage {

    public UISearchPage(IForm form) {
        super(form);
    }

    public UIForm createSearch(UIDataStyleImpl dataStyle) {
        UIForm form = new UIForm(this.getContent());
        UIPanelView find = new UIPanelView(form).setDataStyle(dataStyle);
        var line = find.addLine();
        for (var item : dataStyle.fields().keySet())
            line.addCell(item);
        new UIButton(form).setText("查询").setId("submit");
        return form;
    }

    public UIGridView createGridView(UIDataStyleImpl dataStyle) {
        return new UIGridView(this.getContent()).setDataStyle(dataStyle);
    }

    public UIPhoneView createPhoneView(UIDataStyle style) {
        return new UIPhoneView(this.getContent()).setDataStyle(style); // 若需要修改时使用
    }
}
